package com.spring.cloud.study.service.provider.web;

import com.spring.cloud.study.service.provider.bean.ResultVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author zhanglianxu
 */
@Slf4j
@RestController
public class ServiceController {
    @Bean
    public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
        return restTemplateBuilder.build();
    }

    @RequestMapping(value = "/service/query/{queryId}", method = RequestMethod.GET)
    public ResultVo query(@PathVariable int queryId) {
        return new ResultVo(queryId, 200, "success");
    }
}
